import java.util.StringTokenizer;


class P382_39643 {

	static Scanner382 scanner = new Scanner382();
	
	public static void main(String[] args) {
		
		System.out.println("PERFECTION OUTPUT");
		
		int n = scanner.getInt();
		
		while (n != 0) {
			process(n);
			n = scanner.getInt();
		}
		
		System.out.println("END OF OUTPUT");
		
	}

	private static void process(int n) {

		String number = Integer.toString(n);
		
		for (int k = number.length(); k < 5; k++) {
			System.out.print(" ");
		}
		
		System.out.print(number + "  ");
		
		int sumOfDivisors = getSum(n);
		
		if (n == 1) {
			
			System.out.println("DEFICIENT");
			
		} else if (sumOfDivisors == n) {
		
			System.out.println("PERFECT");
			
		} else if (sumOfDivisors < n) {
			
			System.out.println("DEFICIENT");
			
		} else {
			
			System.out.println("ABUNDANT");
			
		}

		
//		System.out.println("sum: " + sumOfDivisors);
		
	}

	private static int getSum(int n) {
		int sum = 1;
		
		for (int k = 2; k <= n / 2; k++) {
		
			if (n % k == 0)
				sum += k;
			
		}
		
		
		return sum;
	}
	
	
	
}

class Scanner382 {

    StringTokenizer st = null;

    int getInt() {
            if(st == null) st = new StringTokenizer(Reader382.readLn());
            while(! st.hasMoreTokens()) st = new StringTokenizer(Reader382.readLn());
            return Integer.parseInt(st.nextToken());
    }

}

class Reader382 {
static String readLn() {
    String newLine = System.getProperty("line.separator");
    StringBuffer buffer = new StringBuffer();
    int car = -1;
    try {
        car = System.in.read();
        while ((car > 0) && (car != newLine.charAt(0))) {
            buffer.append((char)car);
            car = System.in.read();
        }
        if (car == newLine.charAt(0))
        System.in.skip(newLine.length() - 1);
    } catch (java.io.IOException e) { return (null);}
    if ((car < 0) && (buffer.length() == 0)) return (null);
    return (buffer.toString()).trim();
}
}
